{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f4b68167-f4b1-4940-ab3c-0c3adff8fbf2",
   "metadata": {},
   "source": [
    "## **实践任务4.2** 比较两份名单是否一致"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f5933ee1-4582-4e7c-b28e-799966663af0",
   "metadata": {},
   "outputs": [],
   "source": [
    "名单A = ['张三', '王五', '刘一', '赵六', '孙七', \n",
    "         '李四', '周八', '吴九', '郑十']\n",
    "名单B = ['张三', '刘一', '赵六', '陈二', '李四', \n",
    "         '王五', '孙七', '周八', '郑十']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "9208523a-c2e0-4993-aa2f-b6e13228cf7c",
   "metadata": {},
   "outputs": [],
   "source": [
    "a = set(名单A)\n",
    "b = set(名单B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "02e978a3-8602-400a-871a-96e7132daf05",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2020d2ad-6e46-4cd1-93fc-c1966e99d09f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'吴九', '陈二'}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a ^ b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "447b144b-6c6e-4e6b-b2fa-e8ee019fabba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'吴九'}"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a - b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "11af0249-684a-4587-adf7-c2cbfdb6263c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'陈二'}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b - a"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
